/*
 * Copyright ©2015-2021 Jaemon. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.gitee.jaemon.spring.adorner.demo.controller;

import io.gitee.jaemon.spring.adorner.annotation.ApiNote;
import io.gitee.jaemon.spring.adorner.annotation.GroupNote;
import io.gitee.jaemon.spring.adorner.demo.entity.QueryDTO;
import io.gitee.jaemon.spring.adorner.demo.entity.RequestDTO;
import io.gitee.jaemon.spring.adorner.demo.entity.Response;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * OrderController
 *
 * @author Jaemon
 * @since 1.0
 */
@RestController
@RequestMapping("/order")
@GroupNote("订单接口")
public class OrderController {

    @RequestMapping("/create")
    @ApiNote("创建订单")
    public Response<QueryDTO> create(@RequestBody RequestDTO<QueryDTO> requestDTO) {

        return Response.success(requestDTO.getBody());
    }

    /**
     * 删除订单
     *
     * @param id
     * @return
     */
    @PostMapping("/delete/{id}")
    public Response delete(@PathVariable("id") Long id) {

        return Response.success(id);
    }

    /**
     * 修改订单
     *
     * @param map
     * @return
     */
    @PostMapping(value = {"/modify", "/update"})
    public Response modify(@RequestBody Map<String, Integer> map) {

        return Response.success(map);
    }

    /**
     * 查询订单
     *
     * @param requestDTO
     * @return
     */
    @PostMapping("/query")
    public Response query(@RequestBody QueryDTO requestDTO) {

        return Response.success(requestDTO);
    }
}